package com.rabbitmqproducer.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {
	@Bean
	Queue queueFirst(){
		return new Queue("fanout.First");
	}
	@Bean
	Queue queueSecond(){
		return new Queue("fanout.Second");
	}
	@Bean
	Queue queueThird(){
		return new Queue("fanout.Third");
	}
	@Bean
	FanoutExchange fanoutExchange(){
		return new FanoutExchange("fanoutExchange");
	}
	@Bean
	Binding bindingExchangeFirst(){
		return BindingBuilder.bind(queueFirst()).to(fanoutExchange());
	}
	@Bean
	Binding bindingExchangeSecond(){
		return BindingBuilder.bind(queueSecond()).to(fanoutExchange());
	}
	@Bean
	Binding bindingExchangeThird(){
		return BindingBuilder.bind(queueThird()).to(fanoutExchange());
	}
	@Bean
	Queue queueFourth(){
		return new Queue("fanout.Fourth");
	}
}
